//
//  JLActOrderCheckRequest.m
//  BaseProject
//
//  Created by 王洋 on 2021/4/24.
//  Copyright © 2021 王洋. All rights reserved.
//

#import "JLActOrderCheckRequest.h"

@implementation JLActOrderCheckRequest

+ (void)request_JLActStatusComption:(void (^)(BOOL success, JLActStatusModel *model))comption {

    NSMutableDictionary *dic = @{}.mutableCopy;
    [dic setValue:@"4" forKey:@"type"];//婚品类型（ 1：精选，2：热卖3：新人专享0元购，4：锦鲤活动，5：推荐）
    [dic setValue:[TTUserModel sharedObject].userId forKey:@"userId"];

    NSString *url = [NSString stringWithFormat:@"%@%@",TT_Global_Api_Domain,API_CheckActOrder];

    [TTHttpManager postRequestWithUrl:url TimeOut:10 PostData:dic FinishBlock:^(id  _Nonnull data) {
        if ([data isKindOfClass:[NSDictionary class]]) { //0是未购买     2是购买成功     其他为  uoid
            
            //请求成功
            NSInteger code = [[data valueForKey:@"code"] integerValue];
            if (code == 10000) {

                NSDictionary *dic = [data valueForKey:@"data"];
                JLActStatusModel *model = [JLActStatusModel modelWithDictionary:dic];
                comption(YES, model);
            } else {
                comption(NO, [JLActStatusModel new]);
            }
        } else {
            comption(NO, [JLActStatusModel new]);
        }
    } FailedBlock:^(NSError * _Nonnull error) {
        comption(NO, [JLActStatusModel new]);
    }];

}

@end
